import React, { useState } from 'react'

const App = () => {
    // 如果不需要设置修改值，那么第二个参数完全可以不写
    const [box] = useState({
        w:100,
        h:100
    })

    const [pos, setPos] = useState({
        x:0,
        y:0
    })

    function mouseMove(e){       
        setPos({
            x: e.clientX,
            y: e.clientY
        })

    }

  return (
    <div style={{width: '100vw', height: '100vh'}} onMouseMove={mouseMove}>
        <div>
            元素的宽高： {box.w} --- {box.h}
        </div>
        <div>
            元素的坐标： {pos.x} --- {pos.y}
        </div>
    </div>
  )
}

export default App